package com.tanhua.server.controller;

import com.tanhua.model.db.User;
import com.tanhua.model.vo.HuanXinUserVo;
import com.tanhua.server.interceptor.UserHolder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 获取环信账号密码
 */
@RestController
@RequestMapping("/huanxin/user")
@Slf4j
public class HuanXinController {

    @RequestMapping(method = RequestMethod.GET)
    public ResponseEntity findHuanxinUser(){
        User user = UserHolder.getUser();
        HuanXinUserVo huanXinUserVo = new HuanXinUserVo();
        huanXinUserVo.setPassword(user.getHxPassword());//环信密码
        huanXinUserVo.setUsername(user.getHxUser());//环信账号
        log.debug("*********环信登录成功了************账号{}**********密码{}***************",user.getHxUser(),user.getHxPassword());
        return ResponseEntity.ok(huanXinUserVo);
    }
}
